package com.xuecheng.order.agent.hystrix;

import com.xuecheng.api.search.dto.CoursePubIndexDTO;
import com.xuecheng.common.domain.response.RestResponse;
import com.xuecheng.common.hystrix.BaseAPIHystrix;
import com.xuecheng.common.hystrix.BaseFallbackFactory;
import com.xuecheng.order.agent.CoursePubSearchApiAgent;

/**
 * Created on 2021/04/16/23:19 周五
 *
 * @author Lantin
 */
public class CoursePubSearchApiAgentFallbackFactory extends BaseFallbackFactory<
        BaseAPIHystrix<CoursePubIndexDTO>,
        CoursePubSearchApiAgentFallbackFactory.CoursePubSearchApiAgentHystrix,
        CoursePubSearchApiAgentFallbackFactory.DevCoursePubSearchApiAgentHystrix
        > {

    static class CoursePubSearchApiAgentHystrix extends BaseAPIHystrix<CoursePubIndexDTO> implements CoursePubSearchApiAgent {

        public CoursePubSearchApiAgentHystrix(Throwable throwable) {
            super(throwable);
        }

        @Override
        public RestResponse<CoursePubIndexDTO> getCoursePubById(Long coursePubId) {
            return super.baseFailResult();
        }
    }

    static class DevCoursePubSearchApiAgentHystrix extends BaseAPIHystrix<CoursePubIndexDTO> implements CoursePubSearchApiAgent {

        public DevCoursePubSearchApiAgentHystrix(Throwable throwable) {
            super(throwable);
        }

        @Override
        public RestResponse<CoursePubIndexDTO> getCoursePubById(Long coursePubId) {
            return RestResponse.success(new CoursePubIndexDTO());
        }
    }


}
